package com.cute4j.diffs.cuteswing;

import com.cute4j.swing.Button;
import com.cute4j.swing.Frame;
import com.cute4j.swing.Swing;
import com.cute4j.swing.events.ActionEvent;
import com.cute4j.swing.events.ActionListener;


/**
 * Action Listener Example.
 */
public class ActionListenerExample {

  public static void main(String[] args) {
    // No EDT stuff <-- DIFF+
    // Everything is done in the GUI thread implicitly
    Frame frame = new Frame("Hello World");
    frame.setDefaultCloseOperation(Frame.EXIT_ON_CLOSE);
    Button button = new Button("Close");
    button.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        System.exit(0);
      }
    });
    frame.add(button);
    frame.pack();
    frame.setVisible(true);
    Swing.startEventLoop(); // <-- DIFF-
  }

}
